package at.fhooe.mc.control;

import java.util.List;

import at.fhooe.mc.control.exception.SameClockTickException;
import at.fhooe.mc.data.ElevatorData;
import at.fhooe.mc.data.SystemData;
import at.fhooe.mc.data.control.ElevatorControlData;

/**
 * interface of the abstraction layer
 *
 * @author Thomas Wirth
 *
 */
public interface IAdapter {
	/**
	 * initialize the adapter
	 *
	 * @return true, if no error occurred
	 */
	public boolean init();

	/**
	 * start the polling mechanism
	 *
	 * @param oldInformation the old informations
	 * @param controlElevatorList the control list
	 * @return the new data
	 * @throws SameClockTickException thrown, when polling need to long
	 * @throws Exception other exceptions
	 */
	public SystemData parseData(SystemData oldInformation,
			List<ElevatorControlData> controlElevatorList) throws SameClockTickException,
			Exception;

	/**
	 * update a single elevator
	 *
	 * @param elevator elevator
	 * @param controlData control data
	 * @return true, if the update can be made
	 * @throws Exception
	 */
	public boolean updateNewTarget(ElevatorData elevator,
			ElevatorControlData controlData) throws Exception;

	/**
	 * updates all elevators
	 *
	 * @param systemData system data
	 * @param controlElevatorList control data list
	 * @return true, if all updates can be done
	 * @throws Exception
	 */
	public boolean updateNewTargets(SystemData systemData, List<ElevatorControlData> controlElevatorList)
			throws Exception;
}
